package stardust.core.network.protocol.http;


/**
 * HTTP协议版本
 * <p>
 * 目前HTTP协议版本有1.0和1.1。
 * <p/>
 * @author 陈昶
 */
public enum HttpVersion
{

  /**
   * HTTP 1.0 版本
   */
  http_1_0("HTTP/1.0"),
  /**
   * HTTP 1.1 版本
   */
  http_1_1("HTTP/1.1");

  public final String value;

  private HttpVersion(String value)
  {
    this.value = value;
  }

  public String getValue()
  {
    return this.value;
  }

  public static HttpVersion get(String value)
  {
    HttpVersion[] types = HttpVersion.values();

    for (int i = 0; i < types.length; i++)
    {
      if (types[i].value.equalsIgnoreCase(value))
      {
        return types[i];
      }
    }

    return null;
  }

  public String toString()
  {
    return this.getValue();
  }

}
